﻿using System;
using iMaker.Library;

namespace WebApplication.UserControl
{
    public partial class PaginatorUC : System.Web.UI.UserControl
    {
        public PagerCollection pager;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (pager != null)
                {
                    if (pager.RecordSum > 0)
                        ltlPageRange.Text = (pager.RecordStart + 1).ToString() + " - " + (pager.RecordStart + pager.CurRecordCount).ToString();
                    else
                        ltlPageRange.Text = "0 - 0";
                    hyPrev.NavigateUrl = pager.PrePageLink;
                    hyLast.NavigateUrl = pager.LastPageLink;
                    hyFirst.NavigateUrl = pager.FirstPageLink;
                    txtCur.Text = pager.CurPage.ToString();
                    lblTotalPages.Text = pager.PageCount.ToString();
                    hyGo.NavigateUrl = pager.CurPageLink;
                    hyNext.NavigateUrl = pager.NextPageLink;
                }
            }
        }
    }
}